<!doctype html>
<html lang="zh-CN">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<title>钢链网-提交订单</title>
	<link rel="stylesheet" href="/resource/css/gl_index.css">
	<link rel="stylesheet" href="/resource/css/gl_user.css">

	<script src="/resource/js/jquery-1.11.3.min.js"></script>
	<script src="/resource/js/gl_index.js"></script>
	<script>
        $(function(){
            var popup_submit = '<div class="popup-show popup-submit">';
            popup_submit += '<div class=\"popup-p\">';
            popup_submit +='<i><img src=\"/resource/img/gl_show_succ.png\" alt=""></i>';
            popup_submit +='<div class=\"left\">';
            popup_submit +='订单已提交，请等待审核<br/>';
            popup_submit +='<div class="btn"><a href="javascript:;" class="deter">我的订单</a>';
            popup_submit +='<a href="javascript:;" class="go">继续购物</a></div>';
            popup_submit +='</div><div class=\"popup-close\"></div></div></div>';
            var popup = '<div class="popup"></div><div class="popup-show popup-no">';
            popup += '<div class=\"popup-p\">';
            popup +='<i><img src=\"/resource/img/gl_show_prompt.png\" alt=""></i>';
            popup +='<div class=\"left\">';
            popup +='<span style="font-size:18px;">无法在线交易</span><div style="color:#656464;line-height:20px;margin-bottom:25px;">您好，个人用户无法在线交易，如需在线交易<br/>请使用企业邮箱</div>';
            popup +='<div class="btn"><a href="/user_seller_join" class="deter">申请企业账号</a>';
            popup +='<a href="javascript:;" class="close">取消</a></div>';
            popup +='</div><div class=\"popup-close\"></div></div></div>';
            $('body').append(popup+popup_submit);
            $('.popup-show').css('margin-left',-$('.popup-show').width()/2);
            //提交订单
            $(document).delegate('.btn-succ','click',function(){
                var cart_id =  $("#cart_id").val();
                var pay = $('[name="pay"]:checked').val();
                $.ajax({
                    url: "/shop_generate_order",
                    type: "POST",
                    data: "pay=" + pay+"&cart_id="+cart_id,
                    success: function (msg) {
                        $('.popup-submit').show();
                        $('.popup').show();
                    }
                })

            });
            $(document).delegate('.btn-no','click',function(){
                //未认证
                $('.popup-no').show();
                $('.popup').show();
            });
            $(document).delegate('.popup-no .deter','click',function(){
                window.location.href="/shop_cart_list";
            });
            $(document).delegate('.popup-submit .deter','click',function(){
                window.location.href="/user_order";
            });
            $(document).delegate('.popup-submit .go','click',function(){
                window.location.href="/shopping";
            });
        });
	</script>
</head>
<body>
<div class="head">
    @include('common.user_head')
</div>
<div class="user-head">
	<div class="main">
		<div class="logo">
			<a href="/"><img src="/resource/img/logo.png" alt=""></a>
		</div>
	</div>
</div>	
<div class="shopping shopping-submit">
	<div class="main">
        @if(empty($cart_list_info['supplier_info']))
		<div class="til">公司信息</div>
		<div class="com-info">
			名称：暂时无法购买，请先<a href="javascript:;">申请企业账号</a>
		</div>
        @else
            <div class="til">公司信息</div>
            <div class="com-info">
                名称:{{$cart_list_info['supplier_info']->company}}
            </div>
        @endif
		<div class="til">付款方式</div>
		<div class="pay">
			<ul class="ul-pay">
				<li class="active">
					<div class="pay-box">
						<label for="top1">京东支付</label>
						<input type="radio" name="pay" id="top1" value="{{PaymentEnum::JD_ID}}" checked>
					</div>
					<i></i>
				</li>
				<li>
					<div class="pay-box">
						<label for="top2">承兑汇票</label>
						<input type="radio" name="pay" id="top2" value="{{PaymentEnum::BAB_ID}}">
					</div>
					<i></i>
				</li>
				<li>
					<div class="pay-box">
						<label for="top3">银行转账</label>
						<input type="radio" name="pay" id="top3" value="{{PaymentEnum::BANK_ID}}">
					</div>
					<i></i>
				</li>
			</ul>
		</div>
		<div class="til">订单详情</div>
		<div class="table">
			<table>
				<thead>
					<tr>
						<th width="310px">商品信息</th>
						<th width="120px">钢厂</th>
						<th width="130px">单价</th>
						<th width="130px">件重</th>
						<th width="120px">件数</th>
						<th width="125px">数量</th>
						<th width="140px">合计</th>
					</tr>
					<tr>
						<th colspan="8" class="bg"></th>
					</tr>
				</thead>
                @foreach($cart_list_info['cart_info'] as $v)
				<tbody>
					<tr class="first">
						<td colspan="8">
                            {{$v->storage_place}} {{$v->storage_name}}
							<span>地址：{{$v->storage_address}}</span>
							<span>联系电话：{{$v->storage_phone}}</span>
						</td>
					</tr>
					<tr class="info" >
						<td><div>{{$v->brand_name}}   {{$v->m_name}}   {{$v->product_spec}}</div></td>
						<td><div>{{$v->storage_name}}</div></td>
						<td><div>￥{{$v->product_price}}</div></td>
						<td><div>{{$v->piece_weight}}吨/件</div></td>
						<td><div>{{$v->useable_stock}}</div></td>
						<td><div>{{$v->number}}</div></td>
						<td><div class="total"><span>￥{{round($v->product_price*$v->number*$v->piece_weight,2)}}</span></div></td>
					</tr>
					<tr class="bg">
						<td colspan="8"></td>
					</tr>
				</tbody>
                @endforeach
			</table>
			<div class="table-info">
				<div class="right">
					<div class="box first">商品总价: <span>￥{{round($cart_list_info['sum'][0]->price,2)}}</span></div>
					<div class="box">商品件数: <span>{{$cart_list_info['sum'][0]->num}}件</span></div>
					<div class="box">重量小计：<span>{{round($cart_list_info['sum'][0]->weight,3)}}吨</span></div>
				</div>
			</div>
            <input type="hidden" id="cart_id" value="{{$cart_list_info['cart_id']}}"/>
			<div class="submit">
                @if(!empty($cart_list_info['supplier_info']))
                    @if($cart_list_info['supplier_info']->status==1)
                <a href="javascript:;" class="btn-submit btn-succ">提交订单</a>
                        @else
                        <a href="javascript:;" class="btn-submit btn-no">提交订单</a>
                        @endif
                @else
                <a href="javascript:;" class="btn-submit btn-no">提交订单</a>
                @endif
				<div class="mon right">共付款：<span>￥{{round($cart_list_info['sum'][0]->price,2)}}</span></div>
			</div>
		</div>
	</div>

</div>
@include('common.shop_foot')
</body>
</html>